package com.lxk.seckilldemo.controller;


import com.lxk.seckilldemo.pojo.Order;
import com.lxk.seckilldemo.pojo.User;
import com.lxk.seckilldemo.service.IGoodsService;
import com.lxk.seckilldemo.service.IOrderService;
import com.lxk.seckilldemo.vo.GoodsVo;
import com.lxk.seckilldemo.vo.OrderDetailVo;
import com.lxk.seckilldemo.vo.RespBean;
import com.lxk.seckilldemo.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-07-13
 */
@Controller
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private IGoodsService goodsService;
    @Autowired
    private IOrderService orderService;
    @RequestMapping("/detail")
    @ResponseBody
    public RespBean toStaticDetail(Long orderId, Model model, User user) {
        if (user==null){
            return RespBean.error(RespBeanEnum.ERROR);
        }
        OrderDetailVo orderDetailVo=orderService.detail(orderId);
        return RespBean.success(orderDetailVo);
    }
}
